﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using dpdw.Behaviour.CommandPattern;

namespace dpdw.testing.Behaviour
{
    [TestClass]
    public class TestCommandPattern
    {
        [TestMethod]
        public void TestCommandPatternMethod1()
        {
            System.Diagnostics.Trace.WriteLine("\r\n" + "TestCommandPatternMethod1");

            RemoteControl rc = new RemoteControl();

            Light livingRoomLight = new Light("Living Room");
            Light kichenLight = new Light("Kichen");

            LightOnCommand livingRoomLightOn = new LightOnCommand(livingRoomLight);
            LightOffCommand livingRoomLightOff = new LightOffCommand(livingRoomLight);

            LightOnCommand kichenLightOn = new LightOnCommand(kichenLight);
            LightOffCommand kichenLightOff = new LightOffCommand(kichenLight);

            rc.SetCommand(0, livingRoomLightOn, livingRoomLightOff);
            rc.SetCommand(1, kichenLightOn, kichenLightOff);

            System.Diagnostics.Trace.WriteLine(rc.ToString());

            rc.OnButtonWasPushed(0);
            rc.OnButtonWasPushed(1);

            rc.OffButtonWasPushed(0);
            rc.OffButtonWasPushed(1);

            rc.OnButtonWasPushed(0);
            rc.UndoButtonWasPushed();
        }
    }
}
